package ace.module.weixin.core.impl.properties;

import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;

/**
 * module properties.
 *
 * @author Caspar
 */
@RefreshScope
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ConfigurationProperties(prefix = WeixinCoreProperties.CONFIG_PREFIX)
public class WeixinCoreProperties {

  public static final String CONFIG_PREFIX = "ace.module.weixin";
  private String none = "";

  /**
   * 微信小程序配置
   */
  private List<MiniAppConfigProperties> configs;

  @Data
  @Builder
  @NoArgsConstructor
  @AllArgsConstructor
  public static class MiniAppConfigProperties {

    /**
     * 小程序应用id
     */
    private String appId;

    /**
     * 小程序应用密钥
     */
    private String appSecret;

    /**
     * 设置微信小程序消息服务器配置的token
     */
    private String token;

    /**
     * 设置微信小程序消息服务器配置的EncodingAESKey
     */
    private String aesKey;

    /**
     * 消息格式，XML或者JSON
     */
    private String msgDataFormat;
  }
}